//
//  regardingController.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 16/6/21.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "regardingController.h"
#import "EasyToTescoController.h"

@interface regardingController ()

@property(nonatomic,strong)UILabel *versionLbl;

@end

@implementation regardingController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self buildView];
}

- (void)buildView
{
    self.title = @"关于我们";
    self.view.backgroundColor = BACKGROUND_COLOR;
    self.edgesForExtendedLayout = UIRectEdgeNone;
    UIImageView *image = [[UIImageView alloc] init];
    [self.view addSubview:image];
    image.image = [UIImage imageNamed:@"icon_logo"];
    
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
      
        make.centerX.equalTo(self.view.mas_centerX);
        make.width.mas_equalTo(WIDTH/5*1.25);
        make.height.mas_equalTo(WIDTH/5);
        make.top.equalTo(self.view.mas_top).offset(HEIGHT/16);
    }];
    
    UIView *whiteView = [[UIView alloc] initWithFrame:CGRectMake(0,HEIGHT/8+WIDTH/5,WIDTH,40)];
    [self.view addSubview:whiteView];
    whiteView.backgroundColor = [UIColor whiteColor];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchEasyToTeseco)];
    [whiteView addGestureRecognizer:tap];
    
    UILabel *lbl = [[UILabel alloc] init];
    lbl.text = @"亿乐Go简介";
    [whiteView addSubview:lbl];
    lbl.font = FONT(13);

    [lbl mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(whiteView.mas_centerY);
        make.left.equalTo(whiteView.mas_left).offset(10);
    }];
    
    
    UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"jiantouRight"]];
    [whiteView addSubview:arrowImg];
    
    [arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(whiteView.mas_centerY);
        make.right.equalTo(whiteView.mas_right).offset(-10);
    }];
    
    UILabel *versionLbl = [[UILabel alloc] init];
    versionLbl.textColor = [UIColor grayColor];
    [self.view addSubview:versionLbl];
    versionLbl.font =FONT(11);
    self.versionLbl = versionLbl;
    [versionLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(whiteView.mas_bottom).offset(10);
    }];
    
   
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
        NSString* versionNum = [infoDict objectForKey:@"CFBundleShortVersionString"];
        NSLog(@"%@",versionNum);
        
        dispatch_async(dispatch_get_main_queue(), ^{
            self.versionLbl.text = versionNum;
        });
    });
    
    UILabel *englishLbl = [[UILabel alloc] init];
    [self.view addSubview:englishLbl];
    englishLbl.textColor = [UIColor grayColor];
    englishLbl.text = @"© 2016Suichang Yile e-commerce Limited";
    englishLbl.font = FONT(11);
    
    UILabel *chinaLbl = [[UILabel alloc] init];
    [self.view addSubview:chinaLbl];
    chinaLbl.textColor = [UIColor grayColor];
    chinaLbl.text = @"丽水市遂昌亿乐电子商务有限公司";
    chinaLbl.font = FONT(10);
    
    [englishLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.view.mas_centerX);
        make.bottom.equalTo(self.view.mas_bottom).offset(-HEIGHT/14);
    }];
    
    [chinaLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.view.mas_centerX);
        make.top.equalTo(englishLbl.mas_bottom).offset(5);
    }];
    
}

- (void)touchEasyToTeseco
{
    EasyToTescoController *easyVC = [[EasyToTescoController alloc] init];
    [self.navigationController pushForm:self.navigationController pushToAndHidden:easyVC];
}


@end
